Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace generic state machine index types with dynamic dispatch et al. #305

Merged
merged 6 commits into from
Oct 20, 2024

Conversation

teo-tsirpanis
Copy link
Owner

@teo-tsirpanis teo-tsirpanis commented Oct 14, 2024

Alternative to #78. Instead of instantiating a state machine type with the right combination of index types, make them non-generic and use a switch statement to decide the size of a read every time.

@teo-tsirpanis teo-tsirpanis changed the title Replace generic state machine index types with runtime dispatch et al. Replace generic state machine index types with dynamic dispatch et al. Oct 14, 2024
This reverts commit f39821b.
Performance was not improved by that change.
@teo-tsirpanis
Copy link
Owner Author

teo-tsirpanis commented Oct 20, 2024

Benchmark report

GrammarReaderBenchmark


BenchmarkDotNet v0.14.0, Ubuntu 22.04.5 LTS (Jammy Jellyfish)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 9.0.100-rc.2.24474.11
  [Host]     : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.10 (8.0.1024.46610), X64 RyuJIT AVX2


Method Grammars Mean Error StdDev Ratio Gen0 Gen1 Gen2 Allocated Alloc Ratio
ConvertFarkle6 COBOL85 15,406,224.5 ns 147,437.60 ns 130,699.59 ns 1.00 93.7500 78.1250 - 8912505 B 1.00
ConvertFarkle7 COBOL85 7,641,361.2 ns 90,578.59 ns 84,727.27 ns 0.50 531.2500 523.4375 500.0000 5091185 B 0.57
ConvertFarkle6 JSON 86,176.5 ns 488.93 ns 433.43 ns 1.00 1.2207 - - 110128 B 1.00
ConvertFarkle7 JSON 50,730.8 ns 304.99 ns 285.29 ns 0.59 0.3662 - - 35560 B 0.32
ReadFarkle6 COBOL85 13,931,158.3 ns 139,985.27 ns 130,942.31 ns 1.000 78.1250 62.5000 - 6727625 B 1.000
ReadFarkle7 COBOL85 330,288.8 ns 1,940.51 ns 1,720.21 ns 0.024 - - - 360 B 0.000
ReadFarkle7NoValidation COBOL85 196.8 ns 1.70 ns 1.50 ns 0.000 0.0043 - - 360 B 0.000
ReadFarkle6 JSON 38,033.2 ns 212.20 ns 188.11 ns 1.000 0.4883 - - 42728 B 1.000
ReadFarkle7 JSON 1,710.4 ns 11.61 ns 10.86 ns 0.045 0.0038 - - 360 B 0.008
ReadFarkle7NoValidation JSON 182.2 ns 0.92 ns 0.86 ns 0.005 0.0043 - - 360 B 0.008

Copy link

sonarcloud bot commented Oct 20, 2024

@teo-tsirpanis teo-tsirpanis merged commit 31e34b9 into mainstream Oct 20, 2024
4 checks passed
@teo-tsirpanis teo-tsirpanis deleted the index-size-runtime-dispatch branch October 20, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant